//
//  WeiboTableView.m
//  weibo-01
//
//  Created by HZApple on 16/5/11.
//  Copyright © 2016年 hdu. All rights reserved.
//

#import "WeiboTableView.h"
#import "WeiboCell.h"

@interface WeiboTableView ()

@property (assign, nonatomic) CGFloat y;

@end

@implementation WeiboTableView

- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style {
    if (self = [super initWithFrame:frame style:style]) {
        self.delegate = self;
        self.dataSource = self;
    }
    return self;
}

- (void)awakeFromNib {
    [super awakeFromNib];
    self.delegate = self;
    self.dataSource = self;
}

#pragma mark -tableview delegate

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.weibolist.count;
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    WeiboCell *cell = [tableView dequeueReusableCellWithIdentifier:@"weibocell" forIndexPath:indexPath];
    cell.layout = self.weibolist[indexPath.row];
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    
//    WeiboCell *cell = [tableView viewWithTag:indexPath.row +100];
//    
//    cell.Block = ^(CGFloat height) {_y = height;};
//    NSLog(@"%f",_y);
    
    WeiboCellLayout *weibolayout = self.weibolist[indexPath.row];
    
    
    return weibolayout.cellHeight;
}

@end
